package com.jiutong.meipengdai.ui.activitys;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.jiutong.meipengdai.R;
import com.jiutong.meipengdai.base.BaseActivity;
import com.jiutong.meipengdai.base.CommonAdapter;
import com.jiutong.meipengdai.base.ViewHolder;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 还款
 * Created by suxi on 2017/6/2.
 */

public class RepaymentActivity extends BaseActivity {
    @Bind(R.id.iv_back)
    ImageView ivBack;
    @Bind(R.id.tv_title)
    TextView tvTitle;
    @Bind(R.id.tv_repay_total)
    TextView tvRepayTotal;
    @Bind(R.id.tv_should_repay)
    TextView tvShouldRepay;
    @Bind(R.id.lv_payment)
    ListView lvPayment;
    @Bind(R.id.tv_repayment)
    TextView tvRepayment;
    @Bind(R.id.tv_make_sure)
    TextView tvMakeSure;
    @Bind(R.id.view_deliver_line)
    View deliverLine;

    @Override
    public int getLayoutResouceId() {
        return R.layout.activity_repayment;
    }

    @Override
    protected void initView() {
        super.initView();
        ButterKnife.bind(this);

        tvTitle.setText("还款");
        deliverLine.setLayerType(View.LAYER_TYPE_SOFTWARE, null);//关闭硬件加速
        ArrayList<String> strings = new ArrayList<>();

        for (int i = 0; i<10; i++){
            String s = new String("测试" + i);
            strings.add(s);
        }
        RepaymentListAdapter repaymentListAdapter = new RepaymentListAdapter(mContext, strings, R.layout.view_repayment_item);
        lvPayment.setAdapter(repaymentListAdapter);
    }


    @OnClick({R.id.iv_back, R.id.tv_make_sure})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.tv_make_sure:
                break;
        }
    }

    public class RepaymentListAdapter extends CommonAdapter<String>{

        public RepaymentListAdapter(Context context, List<String> listDatas, int layoutId) {
            super(context, listDatas, layoutId);
        }

        @Override
        protected void fillData(ViewHolder holder, int position) {
            holder.getView(R.id.view_deliver_line).setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        }
    }
}
